import java.util.Scanner;

public class demo02 {
    //反倍数
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int a=sc.nextInt();
        int b=sc.nextInt();
        int c=sc.nextInt();
        int count=0;
        for (int i = 1; i <= n; i++) {
            int tmp=i;
            if(tmp%a!=0&&tmp%b!=0&&tmp%c!=0){
                count++;
            }
        }
        System.out.println(count);
    }
}
